package com.frame.common;

import com.frame.common.enums.LanguageType;
import com.frame.common.model.ReqLanguageInfo;
import lombok.Getter;

public enum RespEnum {
	
	/**
	 * System
	 */
	SUCCESS(200, "请求成功","SUCCESS"),
	DATABASE_BIND_ERROR(301 ,"数据库参数绑定异常",""),
	ERROR_SYSTEM_PARAM(302, "系统参数配置错误",""),
	ERROR_INNER_DATA(303, "内部数据错误",""),
	GET_ERROR_SYSTEM_PARAM(304, "获取系统参数错误",""),
	REDIS_CONECT_ERROR(305, "Redis连接异常",""),
	SERVER_ERROR(500, "服务器正在维护，请稍后重试",""),
	REQUEST_PARAM_ERROR(2000, "请求参数不正确",""),
	USER_AUTHENTICATION(400, "用户验证失败",""),
	LONG_TERM_USER_NOT_LOGGED_IN(401, "用户长期未登录",""),
	SYSTEM_AUTHENTICATION(405 ,"非法请求",""),
	SERVER_TASK_ERROR(502 ,"定时器异常",""),
	NETWORK_ERROR(601, "网络异常",""),
	ERROR_RUNNING_NUM(701, "流水号错误",""),
	SAME_RUNNING_NUM(702, "流水号已被使用",""),
	PHONE_CAPTCHA_ERROR(703 ,"手机验证码错误",""),
	TOO_BUSY(800, "您的操作太频繁，请稍后几秒钟再试",""),
	IS_DELETE(801, "该数据已被删除",""),
	ERROR_MESSAGE(806 ,"%s","%s"),




	

	/**
	 * User 
	 */
	NO_THIS_USER(3001 ,"该用户不存在",""),
	USERNAME_PASSWORD_ERROR(3014 ,"账号或者密码错误","account or password error"),
	PASSWORD_IS_LOCK(3015 ,"输入密码出错过多，账户已被锁定%s小时，请稍后登录。",""),
	USER_PWD_FAILED(3020 ,"密码修改失败",""),
	USER_PWD_ERROR(3021 ,"密码不正确，你还可以输入%s次",""),
	USER_PWD_VERIFY(3022 ,"新密码和确认密码输入不匹配",""),
	USER_PHONE_VERIFY(3023 ,"请输入注册时填写的手机号",""),
	USER_AUTHENTICATION_TYPE_FAIL(3024, "第三方登录验证，类型错误，当前仅支持qq，微信，新浪微博",""),
	USER_AUTHENTICATION_OUT_TIME(3025, "第三方登录验证凭证已过期",""),
	USER_AUTHENTICATION_FAIL(3026 ,"第三方登录失败",""),
	UPDATE_MY_FILES_FAILED(3034,"修改我的信息失败",""),
	OLD_PASSWORD_INCORRECT(3040,"旧密码不正确",""),
	OLD_AND_NEW_PASSWORD_INCORRECT(3041,"新密码与旧密码一致，请重新填写",""),
	PASSWORD_IS_NOT_SAME(3042,"您两次输入的密码不一致，请点击图标显示密码核对后再次设置",""),
	USER_LOGIN_PWD_ERROR_COUNT(3043,"今日输入错误次数已达上限;请24小时后再次操作，若有疑问请联系客服",""),
	USER__LOGIN_PWD_ERROR(3044,"您输入的密码有误，今日还有%s次输入机会",""),
	USER_ACCOUNT_ABNORMAL(3045,"账户状态异常，请联系客服人员",""),
	USER_EXIST(3046,"用户已存在",""),
	THE_ACCOUNT_HAS_BEEN_LOCKED_PLEASE_CONTACT_THE_ADMINISTRATOR(2002,"账号已被锁定,请联系管理员","the account has been locked please contact the administrator"),
	NO_AUTHORITY_PLEASE_CONTACT_THE_ADMINISTRATOR_TO_AUTHORIZE(1008,"没有权限，请联系管理员授权","no authority please contact the administrator to authorize"),





	/**
	 * 微信登录注册
	 */
	USER_WE_CHART_LOGIN_ERROR(3200,"微信登录异常",""),
	USER_WE_CHART_THIRD_INFO_ERROR(3201,"获取微信登录信息失败",""),

	/**
	 * 微信登录注册
	 */
	USER_QQ_LOGIN_ERROR(3202,"QQ登录异常",""),
	USER_QQ_THIRD_INFO_ERROR(3203,"获取QQ登录信息失败",""),

	/**
	 * 新浪登录注册
	 */
	USER_SINA_LOGIN_ERROR(3204,"新浪微博登录异常",""),
	USER_SINA__THIRD_INFO_ERROR(3205,"获取新浪微博登录信息失败",""),


	USER_LREADY_THIRD(3206,"该用户已被绑定",""),
	USER_TOKEN__ERROR(3227, "获取登录认证token或OpenId失败",""),
	USER_AUTHENTICATION_ERROR(3223, "第三方登录，用户验证失败",""),

	CALLBACK_PHONE_BIND_ERROR(14002,"该手机号已绑定，请更换手机号或登录App解绑",""),
	USER_THIRD_PARTY_AUTHENTICATION_ERROR(3224,"第三方用户验证失败",""),

	JSAPI_TICKE_SERVICE_ERROR(14003,"wechat获取JSAPI_TICKE接口失败",""),
	JSAPI_TICKE_SERVICE_EXCEPTION (14005,"wechat获取JSAPI_TICKE接口失败",""),
	JSAPI_ACCESS_TOKEN_SERVICE_EXCEPTION (14006,"wechat获取ACCESS_TOKEN接口失败",""),

	
	/**
	 * Sms
	 */
	SMS_CODE_ERROR(5001, "验证码有误",""),
	SMS_SEND_ERROR(5002,"发送验证码失败",""),
	SMS_SEND_OUT_NUMBER(5003,"获取次数已达上限，请今晚12点后再试",""),
	SMS_SEND_LOG_SAVE_ERROR(5004,"发送验证码,日志记录保存失败",""),
	REPEAT_SEND_SMS_TIME(5005,"1分钟内只能发送1条验证码",""),
	SMS_CODE_SUCCESS(5006,"手机号验证成功",""),
	ENT_CODE_IS_GREATER_FIVE(5007, "验证码已输错3次将锁定时长为3小时，请稍后再试",""),
	USER_MOBILE_FAIL(5008, "用户手机号校验失败",""),
	VERIFICATION_CODE_HAS_FAILED(5009,"验证码已失效",""),


	/**
	 * Idcard
	 */
	IDCARD_EXIST(6001,"身份证已存在",""),
	IDCARD_ERROR(6002,"身份证信息不匹配",""),
	IDCARD_IS_SUBMIT(6003,"信息已提交，不可重复提交",""),
	IDCARD_INSERT_FAILED(6004,"个人身份认证提交失败",""),
	IDCARD_TYPE_ERROR(6005,"请选择正确的证件类型",""),
	IDCARD_CALL_THIRD_ERROR(6006,"调用第三方身份认证校验失败",""),
	IDCARD_PERSONAL_TYPE(6007,"请确认是否是个人身份认证类型",""),
	IDCARD_NOT_EXIST(6008,"用户还未实人认证",""),
	FACE_RECOGNITION_SUCCESS(6009,"人脸识别成功",""),
	FACE_RECOGNITION_FAILED(6010,"人脸识别失败",""),
	UNKNOW_ERROR(6011,"该认证身份认证",""),
	IDCARD_UPDATE_FAILED(6012,"身份证修改资料失败",""),
	IDCARD_NAME_FAIL(6013,"身份证姓名校验失败",""),
	IDCARD_IDCARD_FAIL(6014,"身份证号码校验失败",""),




	/**
	 * 二维码
	 */
	QRC_ERROR(11001,"二维码生成异常",""),



	/**
	 * 优惠卷
	 */
	INVALID_COUPON(12400,"无效的优惠卷",""),


	/**
	 * 校验码（字母）
	 */
	CAPTCHA_ERROR(16001,"校验码输入有误",""),
	
	/**
	 * OCR
	 */
	OCR_IMAGE_ERROR(15000,"请检查您传入的图片是否正确",""),



	/**
	 * 字典
	 */
	KEY_ERROR(24000,"字典key有误",""),


	;

	@Getter
	private final int code;

	private final String desc;

	private final String enDesc;

	public String getDesc() {
		if(ReqLanguageInfo.getLanguageType().equals(LanguageType.EN)){
			return  enDesc;
		}
		return desc;
	}

	public String getDefaultDesc() {
		return desc;
	}

	RespEnum(int code, String desc, String enDesc) {
		this.code = code;
		this.desc = desc;
		this.enDesc = enDesc;
	}
}
